//
//  IGTopicCommentApi.m
//  jingdongfang
//
//  Created by BOE on 2017/9/13.
//  Copyright © 2017年 LJL. All rights reserved.
//

#import "IGCommentApi.h"

@implementation IGCommentApi

- (NSString *)requestUrl {
    return [self customUrl];
}
    
- (id)requestArgument {
    return [self customArg];
}

- (NSString *)customUrl {
    switch (self.parentType) {
        case IGParentTypeArtWork:
            return @"circle/comment/comment";
            break;
        case IGParentTypeTopic:
            return @"circle/comment/comment";
            break;
        case IGParentTypeSubject:
            return @"subject/submitComment";
            break;
        default:
            break;
    }
}

- (id)customArg {
    if (self.parentType == IGParentTypeArtWork || self.parentType == IGParentTypeTopic) {
        return @{
                 @"uid":[IGUser getUid],
                 @"pid": _pid,
                 @"parentType": @(_parentType),
                 @"parentUid": _parentUid,
                 @"cId": _cId,
                 @"commentType": @(_commentType),
                 @"content":_content,
                 @"opusId":_opusId==nil?@"":_opusId
                 };
    } else {//少一个parentType参数
        return @{
                 @"uid":[IGUser getUid],
                 @"pid": _pid,
                 @"parentUid": _parentUid,
                 @"cId": _cId,
                 @"commentType": @(_commentType),
                 @"content":_content
                 };
    }
}

@end

@implementation IGCommentModel

+ (BOOL)propertyIsOptional:(NSString *)propertyName {
    return YES;
}
    
@end

@implementation IGCommentResp
    
@end
